package com.treasure.service.enums;

/**
* @Description:    会员等级与价格对应关系
* @Author:         panxinwen
* @CreateDate:     2018/12/9 15:52
* @Version:        1.0
*/
public enum MemberEnum {

    MEMBER_ZERO(0,0l,"普通用户"),//普通用户
    MEMBER_ONE(1,66l,"创业者"),//创业者
    MEMBER_TWO(2,116l,"创业家"),//创业家
    MEMBER_THREE(3,266l,"合伙人");//合伙人

    private Integer grade;//会员等级
    private Long price;//价格
    private String introduce;//说明

    private MemberEnum(Integer grade, Long price,String introduce) {
        this.grade = grade;
        this.price = price;
        this.introduce = introduce;
    }

    public static Long getPrice(Integer grade){

        for (MemberEnum memberEnum : values()) {
            if (memberEnum.grade == grade) {
                return memberEnum.price;
            }
        }
        return null;
    }

    public static String getIntroduce(Integer grade){

        for (MemberEnum memberEnum : values()) {
            if (memberEnum.grade.intValue() == grade.intValue()) {
                return memberEnum.introduce;
            }
        }

        return "";
    }

    public Integer getGrade() {
        return grade;
    }

    public Long getPrice() {
        return price;
    }

    public String getIntroduce() {
        return introduce;
    }
}
